{% set pageTitle = '' %}
{% set mostViewed = '' %}
{% set mostRecent = '' %}
{% set contactUs = '' %}
{% set contactDescription = '' %}
{% set address = '' %}
{% set email = '' %}
{% set phone = '' %}
{% set testimonials = '' %}
{% set ourPages = '' %}
{% set backToHomepage = '' %}
{% set profileData = app.generic.modelData('Global variables') %}
{% for itm in profileData['_data'] %}
	{% if itm.title == 'Page Title' %}
		{% set pageTitle = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Most viewed' %}
		{% set mostViewed = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Most recent' %}
		{% set mostRecent = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Contact us' %}
		{% set contactUs = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Contact description' %}
		{% set contactDescription = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Address' %}
		{% set address = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Email' %}
		{% set email = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Phone' %}
		{% set phone = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Testimonials' %}
		{% set testimonials = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Our pages' %}
		{% set ourPages = itm.content|langdata(lang)|raw %}
	{% elseif itm.title == 'Back to homepage' %}
		{% set backToHomepage = itm.content|langdata(lang)|raw %}
	{% endif %}
{% endfor %}

{% set newsData = app.generic.modelData('News', '', [], { sort: 'rank', order: 'ASC' }) %}

<!DOCTYPE HTML>
<!--
	Apex by Pixelarity
	pixelarity.com @pixelarity
	License: pixelarity.com/license
-->
<html>
	<head>
		<title>{{ pageTitle }}</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="description" content="" />
		<meta name="keywords" content="" />
		<!--[if lte IE 8]><script src="/css/ie/html5shiv.js"></script><![endif]-->
		<script src="/js/jquery.min.js"></script>
		<script src="/js/jquery.dropotron.min.js"></script>
		<script src="/js/jquery.slidertron.min.js"></script>
		<script src="/js/skel.min.js"></script>
		<script src="/js/skel-layers.min.js"></script>
		<script src="/js/init.js"></script>
		<noscript>
			<link rel="stylesheet" href="/css/skel.css" />
			<link rel="stylesheet" href="/css/style.css" />
			<link rel="stylesheet" href="/css/style-desktop.css" />
		</noscript>
		<!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->
		<style>
			* { font-family: 'Open Sans', sans-serif, "黑体" !important; }
			#nav a { font-size: 18px; }
		</style>
		<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
	</head>
	<body class="homepage">

		<!-- Header Wrapper -->
			<div id="header-wrapper">
			
				<!-- Header -->
					<div class="container">
						<header id="page-header">
							<h1>
								
								<a href="/" id="logo"><span style="font-size: 20px; letter-spacing: -1px; ">{{ pageTitle }}</span></a>
								
								<select style="letter-spacing: 1px; margin-left: 10px;" id="lang-select">
									{% set langData = app.generic.modelData('Language', '', [], { sort: 'rank', order: 'ASC' }) %}
									{% for itm in langData['_data'] %}
										<option {{ itm.urlFragment == lang ? 'selected' : '' }} value="{{ itm.urlFragment }}">{{ itm.title }}</option>
									{% endfor %}
								</select>
							</h1>
							<nav id="nav">
								{{ nav|nav2(lang)|raw }}
							</nav>
						</header>
					</div>
		
			</div>

		{% block content %}
		{% endblock %}

		<!-- Footer -->
			<div id="footer-wrapper">
				<footer id="page-footer" class="container">
					<div class="row">
						<div class="4u">
							
							<!-- Links 1 -->
								<section>
									<h2>{{ mostViewed }}</h2>
									<ul class="style2">
										{% for itm in newsData['_data'] %}
										<li><a href="/{{ lang }}/news/?id={{ itm.id }}">{{ itm.labels|langdata(lang)|raw }}</a></li>
										{% endfor %}
									</ul>
								</section>
							
						</div>
						<div class="4u">
							
							<!-- Links 2 -->
								<section>
									<h2>{{ mostRecent }}</h2>
									<ul class="style2">
										{% for itm in newsData['_data'] %}
										<li><a href="/{{ lang }}/news/?id={{ itm.id }}">{{ itm.labels|langdata(lang)|raw }}</a></li>
										{% endfor %}
									</ul>
								</section>
							
						</div>
						<div class="4u">
							<div class="side-padded">

								<!-- Contact -->
									<section>
										<h2>{{ contactUs|raw }}</h2>
										<p>{{ contactDescription|raw }}</p>
										<ul class="contact">
											<li class="fa-home">
												{{ address|raw }}
											</li>
											<li class="fa-envelope">
												<a href="mailto:{{ email|raw }}">{{ email|raw }}</a>
											</li>
											<li class="fa-phone">
												{{ phone|raw }}
											</li>
										</ul>
									</section>

							</div>
						</div>
					</div>
					<div id="copyright">
						Copyright &copy; China Forestry Group New Zealand, Co. Ltd.
					</div>
				</footer>
			</div>
			
		<script>
			$(function() {
				$('#lang-select').on('change', function() {
					location.href = '/' + $(this).val() + '/{{ urlFragment ~ (urlFragment == '' ? '' : ((id) ? '/?id=' ~ id : '/')) }}';
				});
			});
		</script>
	</body>
</html>